Textures
Textures are used in Kanzi applications for image layers and textured materials for meshes. You can import textures to a Kanzi Studio project from common image file formats, including .jpeg, .png, .tiff, and .psd.
In a Kanzi Studio project, you can access the image files in Library > Resource Files > Images. These image files correspond to the files on your hard drive. When you modify a file on the hard drive, Kanzi automatically applies the modifications to the textures generated from that file. If you remove the file from the hard drive, you cannot use the file in your Kanzi project.
When you export your project to a .kzb file, Kanzi extracts the data from the file and converts it into the target format. You can define the target format for each image in Kanzi Studio. It is important which target format you select because this influences the size of the generated .kzb binary and the loading time when your Kanzi application needs the resource.
Loading time of images depends on their size and compression:
- Image size defines the time required to load the data into RAM.
- Image compression can reduce the size, but keep in mind that before your application can use the image, it must decompressed it, which is often slower than loading the raw data. You can often achieve the fastest start-up times when using Raw image format, where data is loaded into RAM and sent to the GPU memory.
- Texture compression you can use on devices with GPUs that support the selected compression algorithm. When using compression, the data size is smaller both when loading from .kzb to RAM and when loading from RAM to the GPU memory. Also less GPU memory is reserved. Depending on the target hardware, by using texture compression you can reduce loading times. Before using texture compression, make sure that your target platform supports the texture compression format you selected.
Kanzi supports ATC, ETC, PVRTC, and S3TC compression formats, but decompression only for the ETC1. If the hardware does not support texture compression, Kanzi Engine tries to decompress the data before sending it to the GPU. If Kanzi cannot decompress a format, it throws an exception.
See Compressing textures.
Texture types
By assigning textures to materials you can render images on meshes. In Kanzi the following types of textures are available:
- Single textures use a single image for the texture. See Using single textures.
- Cubemap textures combine six square-shaped images into one texture to represent reflections of the environment. Each image represents the scenery in one of the six directions along the X, Y, and Z axes from the viewpoint of the cubemapped object. See Using cubemap textures.
- Render target textures are used for rendering dynamic content from layers into textures. You can use render target textures like any other texture. See Using render target textures.
- Cubemap render target textures are render target textures you can use for creating cubemap textures dynamically from the viewpoint of a given object. Cubemap render target textures are set as targets in Render to cube-map composers to have the texture rendered. See Using cubemap render target textures.
See also
Using single textures
Using cubemap textures
Using cubemap render target textures
Using render target textures
Compressing textures
Images and textures best practices
Resource management
Images
Material types and materials
Meshes
Open topic with navigation